#define _CRT_SECURE_NO_WARNINGS 1

#include "Common.h"
#include "ObjectPool.h"
#include "Concurrent.h"

void Apply1()
{
	for (int i = 0; i < 6; i++)
		void* ptr = ConcurrentAlloc(9);
}

void Apply2()
{
	for (int i = 0; i < 6; i++)
		void* ptr = ConcurrentAlloc(9);
}

void Test2()
{
	void* v[7];
	for (int i = 0; i < 7; i++)
		v[i] = ConcurrentAlloc(6);
	for (int i = 0; i < 7; i++)
		ConcurrentDelete(v[i]);
}
void Test3()
{
	void* v[7];
	for (int i = 0; i < 7; i++)
		v[i] = ConcurrentAlloc(16);
	for (int i = 0; i < 7; i++)
		ConcurrentDelete(v[i]);
}
void TLStest()
{
	std::thread t1(Test2);
	std::thread t2(Test3);
	t1.join();
	t2.join();
}

void Test1()
{
	for (int i = 0; i < 1024; i++)
	{
		std::cout << i << ":";
		void* ptr1 = ConcurrentAlloc(8);
	}
	void* ptr2 = ConcurrentAlloc(7);
	std::cout << ptr2 << std::endl;
}

void Test4()
{
	void* ptr = ConcurrentAlloc(300 * 1024);
	ConcurrentDelete(ptr);

	void* ptr1 = ConcurrentAlloc(200 * 8 * 1024);
	ConcurrentDelete(ptr1);
}

//int main()
//{
//	//TLStest();
//	//Test1();
//	//TLStest();
//	Test4();
//	return 0;
//}